using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Window : MonoBehaviour
{
    public Text TextTitle;
    public Button ButtonClose;
    public Text TextDesc;

    public WdDebug WdDebug;
    public WdChat WdChat;
    public WdFly WdFly;
    public WdScore WdScore;
    public WdSkills WdSkills;
    public WdUsage WdUsage;
    public WdItems WdItems;
    public WdEquips WdEquips;
    public WdOutfit WdOutfit;

    // Start is called before the first frame update
    void Start()
    {
        ButtonClose.onClick.AddListener(OnButtonClose);
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnButtonClose() => this.Hide();
    public void ShowDesc(object ob) => TextDesc.text = ob.ToString();

    public void HideAll()
    {
        TextDesc.text = "";
        WdDebug.Hide();
        WdChat.Hide();
        WdFly.Hide();
        //WdOffline.Hide();
        WdScore.Hide();
        WdSkills.Hide();
        WdUsage.Hide();
        WdItems.Hide();
        WdEquips.Hide();
        WdOutfit.Hide();
    }
    public void Show(string page, object arg = null)
    {
        TextTitle.text = page;
        HideAll();

        if (Zui.Uim.MudCmds.DictCmds.TryGetValue(page, out var actions))
        {
            actions.ActionShow(arg);
        }

        this.Show();
    }
}
